package com.example.server.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface Reviewmapper {
    @Select("select count(*) from user_review where location_id = #{uid}")
    int getlove(int uid);
@Select("select count(*) from user_review where location_id = #{lo_id} and user_id = #{uid}")
    int getbylocation(String lo_id, String uid);
@Select("select count(*) from user_far where location_id = #{loid} and user_id = #{uid}")
    int getfarid(String loid, String uid);
@Insert("insert into user_review(user_id,location_id) values(#{uid},#{lid}) ")
    boolean addlove(String lid, String uid);
@Insert("insert into user_far(location_id,user_id) values(#{lid},#{uid})")
    boolean addfar(String lid, String uid);
@Delete("delete from user_review where location_id = #{lid} and user_id = #{uid}")
    boolean dellove(String lid, String uid);
    @Delete("delete from user_far where location_id = #{lid} and user_id = #{uid}")
    boolean delfar(String lid, String uid);

}
